﻿using System;
using UnityEngine;
using System.Collections;
using System.Linq;
using GameCreator.Characters;
using Gp.Scripts.Database;
using PixelCrushers.DialogueSystem;
using PixelCrushers.DialogueSystem.SequencerCommands;
using UnityEditor;

namespace GP.Scripts.City
{

    /// <summary>
    /// 用于执行动作的Command
    /// </summary>
    public class SequencerCommandATri : SequencerCommand
    { // Rename to SequencerCommand<YourCommand>
        private Transform subject = null;
        private CharacterAnimator _animator = null;
        private AnimationClip _clip = null;
        public void Start() {
            subject = GetSubject(0);
            _animator = subject.GetComponentInChildren<CharacterAnimator>();
            _clip = AnimationClipDatabase.Instance.FindClipByName(GetParameter(1));
            if (_clip != null) {
                _animator.CrossFadeGesture(_clip,1f, null, 0.05f, 0.5f);
            };
        }

        public void Awake()
        {
            // Add your initialization code here. You can use the GetParameter***() and GetSubject()
            // functions to get information from the command's parameters. You can also use the
            // Sequencer property to access the SequencerCamera, CameraAngle, Speaker, Listener,
            // SubtitleEndTime, and other properties on the sequencer. If IsAudioMuted() is true, 
            // the player has muted audio.
            //
            // If your sequencer command only does something immediately and then finishes,
            // you can call Stop() here and remove the Update() method:
            //
            // Stop();
            //
            // If you want to use a coroutine, use a Start() method in place of or in addition to
            // this method.
        }

        public void Update()
        {
            // Add any update code here. When the command is done, call Stop().
            // If you've called stop above in Awake(), you can delete this method.
        }

        public void OnDestroy()
        {
            
        }

    }

}


